package com.wushi.lenovo.asia5b.app_http;

import com.mvp.base.model.ResultModel;
import com.mvp.common.GlobalValue;
import com.wushi.lenovo.asia5b.app_model.credit.CreditMinModel;

import java.util.Map;

import io.reactivex.Observable;
import okhttp3.ResponseBody;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
import retrofit2.http.Path;

/**
 * Created by zhangyuncai on 2019/2/19.
 */
public interface TopupService {
    /**
     * 跳转第三方网关之前验证信用卡号
     * member_id	integer	Id of the specified member
     * card_number	string	Credit Card Number
     * credit_card_amount	float	Credit Card Topup Amount
     * other_amount	float	Credit Card topup other amount
     * save_credit_card	integer	Save this credit card info as default 保存==0  不保存==1
     * name_on_card	string	Credit Card Holder Name
     * expiration_date	integer	Credit Card expiry date e.g. 0820
     * cvv	integer	Credit Card CVV Number
     *
     * @return
     */
    @FormUrlEncoded
    @POST(GlobalValue.Base_Version_Url + "{url}")
    Observable<ResultModel> validateTopup(@Path("url") String url, @FieldMap Map<String, Object> map
    );

    /**
     * 用信用卡充值我的账户
     *
     * @param map
     * @return
     */
    @FormUrlEncoded
    @POST("{url}")
    Observable<ResponseBody> thirdTopup(@Path("url") String url, @FieldMap Map<String, Object> map
    );

    //获取银行列表
    @POST(GlobalValue.Base_Version_Url + "cart.get.fpx.bank.list")
    Observable<ResultModel<Map<String, String>>> getBanks(
    );

    @POST(GlobalValue.Base_Version_Url + "cart.get.min.topup.amount")
    Observable<ResultModel<Integer>> getTopupMinAmount(
    );

    //获取各种最小值
    @FormUrlEncoded
    @POST(GlobalValue.Base_Version_Url + "get.minimumValue")
    Observable<ResultModel<CreditMinModel>> getCreditMin(@Field("member_id") int member_id
    );

    //订单付款余额充足付款
    @FormUrlEncoded
    @POST(GlobalValue.Base_Version_Url + "cart.checkout.topup.submit")
    Observable<ResultModel> submitTopupForPayment(@FieldMap Map<String, Object> map
    );

    /**
     * 余额支付订单
     * member_id	integer	Id of the specified member
     * source	string	Source of the daigou country, default 1 = china daigou
     * language_code	string	Language code, e.g. en, cn
     * country_id	string	Country ID, e.g. 87 = Malaysia
     * checkout_log_id	integer	Checkout log ID
     * <p>
     * payment	String	Array of Payment (refer below payment(JSON))
     */
    @FormUrlEncoded
    @POST(GlobalValue.Base_Version_Url + "cart.payment.add")
    Observable<ResultModel> addCartPayment(
            @FieldMap Map<String, Object> map);

}
